# Maintainer: David Runge <dvzrv@archlinux.org>
# Contributor: Lukas Fleischer <lfleischer@archlinux.org>
# Contributor: sputnick <gilles DOT quenot AT gmail DOT com>

pkgname=xwax
pkgver=1.8
pkgrel=2
pkgdesc='Open-source vinyl emulation software for Linux.'
arch=(loong64 x86_64)
url="https://www.xwax.co.uk/"
license=(GPL3)
depends=(
  glibc
  sdl
  sdl_ttf
  sh
  ttf-dejavu
)
makedepends=(
  alsa-lib
  jack
)
optdepends=(
  'cdparanoia: for direct CD import'
  'faad: for AAC import'
  'ffmpeg: for various audio and video import'
  'flac: for FLAC import'
  'mpg123: for MP3 import'
  'sox: for live audio import'
  'vorbis-tools: for OGG import'
)
source=(https://www.xwax.co.uk/releases/$pkgname-$pkgver.tar.gz)
sha512sums=('db37a16ecc5437f9b085c17e5e645e04b76a18aa7f7d8e8448a2994435596394ea7f2b52a6734194be7cf0b7099995f0f8735c2c547f3f57525339c4dc671d9d')
b2sums=('7fbde34e6c1a3508da6ea8230cec7d2663503882182e403bf9bbf2b7327248c1b2e38a21392615a359d30d4a65f558e55346f99bf8f89621a18bcf9e8cf09139')

build() {
  local configure_options=(
    --prefix /usr
    --enable-alsa
    --enable-jack
  )

  cd $pkgname-$pkgver
  ./configure "${configure_options[@]}"
  make
}

package() {
  depends+=(
    alsa-lib libasound.so
    jack libjack.so
  )

  make DESTDIR="$pkgdir" EXECDIR="/usr/lib/$pkgname" install -C $pkgname-$pkgver
  install -vDm 644 $pkgname-$pkgver/{CHANGES,README} -t "$pkgdir/usr/share/doc/$pkgname/"
}
